﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MyFavor : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string empID = Session["EmpID"] != null ? Session["EmpID"].ToString() : "";
        if (empID == "")
        {
            DVTips.InnerHtml = "<h2>哎呦，您没有登录呢！</h2>";
            DVNoData.Visible = true;
            return;
        }
        string cmd = string.Format("SELECT FavorList.[No], DataList.Item, DataList.Major, DataList.TotalViewTimes FROM (FavorList INNER JOIN DataList ON FavorList.DataNo = DataList.[No]) WHERE FavorList.EmpID = '{0}'", empID);
        DBOperate myDB = new DBOperate();
        myDB.SetCommandString(cmd);
        GVMyFavor.DataSource = myDB.ExecuteReader();
        GVMyFavor.DataBind();
        myDB.CloseDB();
        if (GVMyFavor.Rows.Count != 0)
        {
            DVNoData.Visible = false;
        }
        else
        {
            DVNoData.Visible = true;
        }

    }
}
